
% Function: Gaussian1D_Kernel
% Author: Oskar Skrinjar
% Date: December 29, 2009
% ------------------------------------------------------------------------
% The function computes 1D Gaussian kernel for given pixel physical size
% (delta [mm]) and standard deviation (sigma [mm]).


function H = Gaussian1D_Kernel(delta, sigma)

N = ceil(8*sigma/delta);

% if N is even then make N odd by adding 1
if (round(N/2)==(N/2))
    N = N + 1;
end

d = delta*(-(N/2)+0.5:N/2);

H = exp(-(d.^2/(2*sigma^2))); 
H = H/sum(H(:));